<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>ajax get</title>
  <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>

</head>
<body>
<textarea name="" id="content" cols="80" rows="10"></textarea>
<input id="btn" type="button" value="get"/>
<script>
  $(function () {
    $("#btn").on("click", function () {
      $.get("/read.php",
        {
          "filename": "test.txt"
        },
        function (r) {
          if (r.code) {
            alert("出错了");
          } else {
            $("#content").val(r.data.content);
          }
        },
        "json"
      );
    });
  });
</script>
</body>
</html>